<!DOCTYPE html>
<html>
<head>
    <title>提现审核</title>
    <include file='public/head'>
    <style>
        .layui-legend-size{font-size:14px !important;}
        .layui-nopadding{padding:0 !important;}
        .layui-overflow{overflow:auto;}
        .layui-nomargin{margin: 0 !important;}
        .layui-bottom{border-bottom:1px solid rgb(226, 226, 226);}
        .layui-input{height:30px !important; }
        .layui-form-search-item .layui-inline{margin-bottom: 5px;} 
        .layui-form-search-item label{margin-left: 15px;}
        .layui-table-page {padding: 7px 0px 0px;}
        .layui-field-padding{border-width: 1px;padding:0 0 5px 10px;}
    </style>
</head>
<body>
<!-- layui-tab开始 -->
<div class="layui-tab " lay-filter="demo-tab" class="js-check-wrap">
    <!-- 顶部导航菜单开始 -->
    <div class="layui-tab-nav" >
        <ul class="layui-tab-title">
            {:getNav('fund','admin_index/presentation')};
        </ul>
    </div>

    <!-- 顶部导航菜单结束 -->
    <fieldset class="layui-elem-field layui-field-title layui-field-padding">
        <legend class="layui-legend-size">搜索</legend>
        <form class="layui-form table-bar" action="{:cmf_plugin_url('Fund://admin_index/presentation')}" lay-filter="form-bar" method="post">
            <label>输入搜索：</label>
            <div class="layui-inline ">
                <div class="layui-input-inline " style="width: 150px;">
                    <input type="text" name="keywords" autocomplete="off" class="layui-input" placeholder="用户名称/订单编号" value="{$data.keywords|default=''}">
                </div>
            </div>

            <label>操作时间：</label>
            <div class="layui-inline ">
                <div class="layui-input-inline " style="width: 100px;">
                    <input type="text" name="start_time" autocomplete="off" class="layui-input" id="test1" placeholder="" value="{$data.start_time|default=''}">
                </div>
                -
                <div class="layui-input-inline " style="width: 100px;">
                    <input type="text" name="end_time" autocomplete="off" class="layui-input" id="test2" placeholder="" value="{$data.end_time|default=''}">
                </div>
            </div>
        
            <button type="submit" class="layui-btn layui-btn-sm layui-btn-primary " style="font-weight:800;" lay-submit="" lay-filter="demo2"><i class="layui-icon ">&#xe615;</i>搜索</button>
        </form>
    </fieldset>

	<!-- 表格内容开始 -->
    <div class="layui-card">
        <div class="layui-card-header layui-bg-gray layui-bottom">
            <a href="javascript:;" class="layui-btn layui-btn-xs layui-btn-danger batch-delete" onclick="allDelete()"><i class="layui-icon">&#xe640;</i>批量删除</a>
        </div>
        <div class="layui-card-body layui-nopadding " >
            <form method="post" id="f">
            <table  class="layui-table layui-nomargin" >
                <!-- 表格头 -->
                <thead>
                    <tr>
                        <th>
                            <input type="checkbox" value="" id="check_box_all" >
                        </th>
                        <th>提现用户</th>
                        <th>用户组</th>
                        <th>订单号</th>
                        <th>提现账户</th>
                        <th>提现金额</th>
                        <th>状态</th>
                        <th>提现日期</th>
                        <th>操作时间</th>

                        <th>手机号码</th>
                        <th>提现方式</th>
                        
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>
                <!-- 表格头 -->
                <!-- 表格内容输出 -->
                <volist name="list" id="vo">
                    <tr>
                        <td>
                            <input type="checkbox" class="check_box" name="id[]" value="{$vo['id']}">
                        </td>
                        <td>{$vo['accountname']}</td>
                        <td>用户</td>
                        <td>{$vo['trade_sn']}</td>
                        <td>{$vo['account']}</td>
                        <td>￥{$vo['amount']}</td>
                        <td>
                            <switch name="$vo['status']">
                                <case value="1">
                                    <span style="color:#1cbb9b;" >提交</span></case>
                                <case value="2">
                                    <span style="color:#55acee;" >审核通过</span></case>
                                <case value="3">
                                <span style="color:#f40;" >未通过</span></case>
                            </switch>
                        </td>
                        <td>{:date('Y-m-d H:i:s',$vo['addtime'])}</td>
                        <td>{:date('Y-m-d H:i:s',$vo['addtime'])}</td>

                        <td>{$vo['phone']}</td>
                        <td>{$contype[$vo['type']]}</td>
                        
                        <td>
                            <if condition="$vo['status']==1">
                                <switch name="$vo['number']">
                                        <case 1><a href="#" onclick="makeMoney({$vo['id']})"  class="btn btn-info btn-sm ">手动打款</a></case>
                                        <case 2><a href="#" onclick="zidong({$vo['id']},{$vo['type']})"  class="btn btn-info btn-sm">自动打款</a></case>
                                        <case 3><a href="#" onclick="makeMoney({$vo['id']})"  class="btn btn-info btn-sm ">手动打款</a>
                                        <a href="#" onclick="zidong({$vo['id']},{$vo['type']})"  class="btn btn-info btn-sm">自动打款</a>
                                    </case>
                                </switch>
                                <a href="javascript:;"  onclick="edit({$vo['id']})" class="btn btn-danger btn-sm">拒绝</a>
                                <elseif condition="$vo['status']==2">
                                <if condition="empty($vo['make'])">
                                    <p>已自动打款</p>
                                    <else />
                                    <a href="#" onclick="makekan({$vo['id']});"  class="btn btn-info btn-sm">已手动打款</a>
                                </if>
                                <elseif condition="$vo['status']==3">
                                <button type='button' class="btn btn-default btn-sm">已拒绝</button>
                                <a class="btn btn-info btn-sm" onclick="view({$vo.id})">查看退回原因</a>
                            </if>
                        </td>
                    </tr>
                 </volist>
                </tbody>
            </table>
            </form>
            <div class="layui-table-page">
                <div id="layui-table-page1">
                    <div class="layui-box layui-laypage layui-laypage-default" id="layui-laypage-1">
                        {$page|default=''}
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div id="write" class="wrap" style="display: none">
        <form method="post" class="js-ajax-form" action="{:cmf_plugin_url('Fund://admin_index/pre_up')}">
            <input type="hidden" name="id" id="pre_id" value="">

               <textarea name="jujue" style="height: 300px" placeholder="请输入拒绝内容" class="form-control"></textarea>

            <button type="submit" class="btn btn-success js-ajax-submit" style="float: right;margin-top: 80px">提交</button>
        </form>
        
    </div>  

    <div id="make" class="wrap" style="display: none">
            <form method="post" class="js-ajax-form" action="{:cmf_plugin_url('Fund://admin_index/adopt')}">
                <input type="hidden" name="id" id="make_id" value="">
    
                   <textarea name="make" style="height: 300px" placeholder="请输入打款账户" class="form-control"></textarea>
    
                <button type="submit" class="btn btn-success js-ajax-submit" style="float: right;margin-top: 80px">提交</button>
            </form>
    </div>  

    <div id="write2" class="wrap" style="display: none">
        <form method="post" class="js-ajax-form" action="#">
            <textarea name="jujue" id="con" style="height: 300px" placeholder="请输入拒绝内容" class="form-control"></textarea>
        </form>
        
    </div>  

    <div id="makekan" class="wrap" style="display: none">
            <form method="post" class="js-ajax-form" action="#">
                <textarea name="jujue" id="con2" style="height: 300px" placeholder="请输入拒绝内容" class="form-control"></textarea>
            </form>
            
    </div>  


</div>


<include file="public/scripts"/>
<script type="text/javascript">



    //全选/取消
    $('#check_box_all').on('click',function(){
        $('.check_box').prop('checked',$('#check_box_all').prop('checked'));
    }); 

layui.use('laydate', function(){
    var laydate = layui.laydate;
    //自定义格式
    laydate.render({
        elem: '#test1'
    });
    laydate.render({
        elem: '#test2'
    });
});



 
   //编辑理由
   function edit(id){
     $("#pre_id").val(id);
     layer.open({
        title:"请写驳回理由",
        type:1,
        area:['650px','500px'],
        content:$("#write"),
        end: function () {
            $("#write").css('display','none');
        }
     })
   }

   $("#active1").attr("class","active");

  //自动打款
   function zidong(id,status){
    
        layer.confirm('您确定自动打款吗？', {
        btn: ['确定', '取消'] //可以无限个按钮
        
        }, function(index, layero){

            $.ajax({
            type:"get",// get或者post
            url:"{:cmf_plugin_url('Fund://admin_index/adopt')}",// 请求的url地
            data:{id:id,status:status},
            dataType:"json",
            success:function(data){
                if( data['msg']=='提现通过' ){
                    layer.msg('自动打款成功',{icon: 1,time:2000}, function(){

                        location.reload();

                      }); 
                    
                }else{
                    layer.msg(data['msg'],{icon: 2,time:2000}, function(){

                    location.reload();

                    }); 
                }
                
            }
            });

       
        }, function(index){
              
        });
   }


   //打款账户
   function makeMoney(id){
     $("#make_id").val(id);
     layer.open({
        title:"请填写打款账户",
        type:1,
        area:['650px','500px'],
        content:$("#make"),
        end: function () {
            $("#make").css('display','none');
        }
     })
   }

   //打款
   function makekan(id){
     var da ='';
      $.ajax({
       type:"get",// get或者post
       url:"{:cmf_plugin_url('Fund://admin_index/makekan')}",// 请求的url地
       data:{id},
       dataType:"json",
       success:function(data){
         da = data;
         $("#con2").val(da);
       }
      });
    
      layer.open({
        title:"驳回理由",
        type:1,
        area:['650px','500px'],
        content:$("#makekan"),
        end: function () {
            $("#makekan").css('display','none');
        }
        
     })
   }


 
   function view(id){
     var da ='';
      $.ajax({
       type:"get",// get或者post
       url:"{:cmf_plugin_url('Fund://admin_index/fundcon')}",// 请求的url地
       data:{id},
       dataType:"json",
       success:function(data){
         da = data;
         $("#con").val(da);
       }
      });
    
      layer.open({
        title:"驳回理由",
        type:1,
        area:['650px','500px'],
        content:$("#write2"),
        end: function () {
            $("#write2").css('display','none');
        }
        
     })
   }


</script>
</body>
</html>